<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ include file="../include/tag.jsp" %>
<tr data-parentid="${cHelp.parentId}">

    <c:set var="thatCount" value="${fn:length(fn:split(cHelp.parentIds, ','))}"></c:set>
    <c:choose>
        <c:when test="${cHelp.parentId == null}">
            <td><strong>${cHelp.title}</strong></td>
        </c:when>
        <c:when test="${cHelp.parentId == '0'}">
            <td>
                <strong>${cHelp.title}</strong>
                <c:if test="${fn:length(cHelp.childrens) > 0 && cHelp.title != '众筹攻略'}">
                    <div class="option" style="display: inline-block" data-id="${cHelp.id}">
                        <i class="iconfont icon-unfold open"></i>
                    </div>
                </c:if>
            </td>
        </c:when>
        <c:when test="${cHelp.parentId != '0'}">
            <td><div style="text-indent: ${thatCount * 40}px">${cHelp.sort}.${cHelp.title}</div></td>
        </c:when>
    </c:choose>
    <td><fmt:formatDate value="${cHelp.updateDate}" pattern="yyyy-MM-dd HH:mm"/></td>
    <td class="tb-opts">
        <div class="comm-opts">
            <c:if test="${cHelp.title == '众筹攻略'}">
                <a href="${ctx}/help/help/getCommonProblemById.do?id=${cHelp.id}&type=0" class="green"
                   target="_self">编辑</a>
            </c:if>
            <c:if test="${cHelp.title != '众筹攻略'}">
                <c:if test="${cHelp.parentId == '0'}">
                    <a href="javascript:addFirstCategory('${cHelp.id}')" class="green" target="_self">编辑</a>
                    <a href="javascript:txz.deleteObject('确定要删除吗？', '${ctx}/help/help/${cHelp.id}/delete.do', '该父级下面有子级，请先删除子级')"
                       class="red" target="_self">删除</a>
                    <a href="${ctx}/help/help/getCommonProblemById.do?id=${cHelp.id}&type=2" class="gray"
                       target="_self">新增内容</a>
                </c:if>
                <c:if test="${cHelp.parentId != '0'}">
                    <a href="${ctx}/help/help/getCommonProblemById.do?id=${cHelp.id}&type=1" class="green"
                       target="_self">编辑</a>
                    <a href="javascript:txz.deleteObject('确定要删除吗？', '${ctx}/help/help/${cHelp.id}/delete.do', '该父级下面有子级，请先删除子级')"
                       class="red" target="_self">删除</a>
                </c:if>

            </c:if>
        </div>
    </td>
    <c:if test="${fn:length(cHelp.childrens) > 0 && cHelp.title != '众筹攻略'}">
        <c:forEach var="ccHelp" items="${cHelp.childrens}">
            <c:set var="cHelp" value="${ccHelp}" scope="request"/>
            <jsp:include page="commonProblemTreeInclude.jsp"></jsp:include>
        </c:forEach>
    </c:if>
</tr>